<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
    <script src="https://www.dowebok.com/demo/2013/5/js/jquery.collapse.js"></script>
</head>
<body>
  
    <input type="file" name="chooseImg" id="chooseImg"  accept="image/*"   multiple custom-on-change="takePicture"  /> 
    <script>
        $('#chooseImg').change(function(){    
            upload($('#chooseImg').get(0).files[0])
	 	})
        function upload(file){
			 var formData = new FormData(); 
			      formData.append('files', file);  
				  $.ajax({
					  url: "/test/upload",
					  type: "POST",
					  data: formData, 
					  contentType: false, 
					  processData: false,
					  success: function (data) {
						  console.log("data: ",data);   
					  }, 
				  });  
		}
		

    </script>
</body>
</html>